﻿using Domain.Interface.Organization;
using Framework.Domain.DomainObject.Bo;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace Domain.Organization.BusinessObjects
{
    [Table("Users")]
    public class UserEntity : BaseBoEntity
    {
        public string Name { get; set; }
    }


    public class UserDomain : BaseBo, IUserDomain
    {
        /// <summary>
        /// 数据实体
        /// </summary>
        private UserEntity SelfEntity
        {
            get { return this.Entity as UserEntity; }
            set { this.Entity = value; }
        }

        #region 构造函数
        public UserDomain(UserEntity entity)
        {
            this.SelfEntity = entity;
        }

        public UserDomain(string name)
        {
            this.SelfEntity = new UserEntity()
            {
                KeyId = Guid.NewGuid(),
                Name = name,
                CreateTime = DateTime.Now,
                UpdateTime = DateTime.Now,
                IsDelete = false,
                Version = 1,
                CreateUserKeyId = Guid.NewGuid(),
                UpdateUserKeyId = Guid.NewGuid(),
            };
        }
        #endregion

        #region IUserDomain 实现
        public string Test()
        {
            return "OK";
        }
        #endregion





        public string GetName()
        {
            return SelfEntity.Name;
        }

        public void SetName(string name)
        {
            SelfEntity.Name = name;
        }



    }




}
